package com.cxlin.cwanandroid.di

import com.cxlin.cwanandroid.model.api.WanRetrofitClient
import com.cxlin.cwanandroid.model.api.WanService
import com.cxlin.cwanandroid.model.repository.CollectRepository
import com.cxlin.cwanandroid.model.repository.HomeRepository
import com.cxlin.cwanandroid.model.repository.LoginRepository
import com.cxlin.cwanandroid.model.repository.NavigationRepository
import com.cxlin.cwanandroid.model.repository.ProjectRepository
import com.cxlin.cwanandroid.model.repository.SearchRepository
import com.cxlin.cwanandroid.model.repository.SquareRepository
import com.cxlin.cwanandroid.model.repository.SystemRepository
import com.cxlin.cwanandroid.ui.blog.viewmodel.BlogViewModel
import com.cxlin.cwanandroid.ui.blog.viewmodel.TabBlogViewModel
import com.cxlin.cwanandroid.ui.home.viewmodel.HomeViewModel
import com.cxlin.cwanandroid.ui.home.viewmodel.NavigationViewModel
import com.cxlin.cwanandroid.ui.home.viewmodel.ProjectTypeViewModel
import com.cxlin.cwanandroid.ui.home.viewmodel.SquareViewModel
import com.cxlin.cwanandroid.ui.home.viewmodel.SystemViewModel
import com.cxlin.cwanandroid.ui.login.viewmodel.LoginViewModel
import com.cxlin.cwanandroid.ui.me.viewmodel.MeViewModel
import com.cxlin.cwanandroid.ui.project.viewmodel.ProjectTabViewModel
import com.cxlin.cwanandroid.ui.project.viewmodel.ProjectViewModel
import com.cxlin.cwanandroid.ui.search.viewmodel.SearchRecommendViewModel
import com.cxlin.cwanandroid.ui.search.viewmodel.SearchViewModel
import com.cxlin.cwanandroid.ui.systemtype.viewmodel.SystemTypeViewModel
import org.koin.androidx.viewmodel.dsl.viewModel
import org.koin.dsl.module

/**
 *
 * @Author: chenxunlin
 * @Date: 2024/4/26 15:03
 */
val viewModelModule = module {
    viewModel { HomeViewModel(get()) }
    viewModel { LoginViewModel(get()) }
    viewModel { MeViewModel() }
    viewModel { BlogViewModel(get(),get()) }
    viewModel { SquareViewModel(get()) }
    viewModel { ProjectTypeViewModel(get(),get()) }
    viewModel { SystemViewModel(get(),get()) }
    viewModel { SystemTypeViewModel(get(),get()) }
    viewModel { NavigationViewModel(get()) }
    viewModel { TabBlogViewModel(get()) }
    viewModel { SearchRecommendViewModel(get(),get()) }
    viewModel { SearchViewModel(get(),get()) }
    viewModel { ProjectTabViewModel(get()) }
    viewModel { ProjectViewModel(get(),get()) }
}

val respositoryModule = module {
    single { WanRetrofitClient.getService(WanService::class.java, WanService.BASE_URL) }
    single { HomeRepository() }
    single { LoginRepository() }
    single { ProjectRepository() }
    single { SquareRepository() }
    single { SystemRepository() }
    single { CollectRepository() }
    single { NavigationRepository() }
    single { SearchRepository() }
}

val appModule = listOf(viewModelModule, respositoryModule)